<?php

namespace App\Http\Controllers\Test;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\App;
use Pusher\Pusher;

class NotificationController extends Controller
{
    //


    public function getIndex()
    {
        return view('notification');
    }

    public function postNotify(Request $request)
    {

        $notifyText=e($request->input('notify_text'));
        $app_key=getenv('PUSHER_KEY');
        $app_secret=getenv('PUSHER_SECRET');
        $app_id=getenv('PUSHER_APP_ID');
        $app_cluster=getenv('PUSHER_APP_CLUSTER');
        $pusher=new Pusher($app_key, $app_secret, $app_id, array( 'cluster' => $app_cluster));

        $pusher->trigger('notifications','new-notification',$notifyText);
    }
}
